package com.zj.docker.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Auther: zj
 * @Date: 2019/2/4 12:50
 * @Description:
 */
@FeignClient(name = "log",fallback = LogClient.ApiGateWayFallback.class)
public interface LogClient {

    @GetMapping("/createLog")
    void createLog(@RequestParam(value = "logId",required = false,defaultValue ="") String logId,
                          @RequestParam(value = "username",required = false,defaultValue = "") String username,
                          @RequestParam(value = "userId",required = false,defaultValue ="") String userId,
                          @RequestParam(value = "type",required = false,defaultValue ="") Integer type,
                          @RequestParam(value = "description",required = false,defaultValue ="") String description,
                          @RequestParam(value = "action",required = false,defaultValue ="") String action,
                          @RequestParam(value = "method",required = false,defaultValue ="") String method,
                          @RequestParam(value = "ip",required = false,defaultValue ="") String ip,
                          @RequestParam(value = "userAgent",required = false,defaultValue ="") String userAgent,
                          @RequestParam(value = "param",required = false,defaultValue ="") String param,
                          @RequestParam(value = "exception",required = false,defaultValue ="") String exception,
                          @RequestParam(value = "createDate",required = false,defaultValue ="") String createDate);

    @Component
    class ApiGateWayFallback implements LogClient{
        @Override
        public void createLog(String logId, String username, String userId, Integer type, String description, String action, String method, String ip, String userAgent, String param, String exception, String createDate) {
            System.out.println( "记录时日志出现异常！！！" );
        }
    }
}
